package com.tuniondata.netty.server;

import com.tuniondata.netty.bean.MessageDecoder;
import com.tuniondata.netty.bean.MessageEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

public class ChildChannelHandler extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        // 解码转
        ch.pipeline().addLast(new MessageDecoder());
        // 编码器
        ch.pipeline().addLast(new MessageEncoder());
        // 在管道中添加我们自己的接收数据实现方法
        ch.pipeline().addLast(new ApiServerHandler());
    }
}
